<?php
	session_start();
	include "include.php";
?>
<html>
<head>
<title><?php echo $SITE_TITLE ?> - Loot Report</title>
<link rel="stylesheet" type="text/css" href="main.css" /></head>
<body onLoad="javascript:ajaxFunction(0)">

<script type="text/javascript" language="JavaScript">
var cX = 0; var cY = 0; var rX = 0; var rY = 0;
function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; }
function AssignPosition(d) {
if(self.pageYOffset) {
rX = self.pageXOffset;
rY = self.pageYOffset;
}
else if(document.documentElement && document.documentElement.scrollTop) {
rX = document.documentElement.scrollLeft;
rY = document.documentElement.scrollTop;
}
else if(document.body) {
rX = document.body.scrollLeft;
rY = document.body.scrollTop;
}
if(document.all) {
cX += rX;
cY += rY;
}
d.style.left = (cX+10) + "px";
d.style.top = (cY+10) + "px";
}
function HideText(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "none";
}
function ShowText(d) {
if(d.length < 1) { return; }
var dd = document.getElementById(d);
AssignPosition(dd);
dd.style.display = "block";
}
function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
var dd = document.getElementById(d);
AssignPosition(dd);
if(dd.style.display == "none") { dd.style.display = "block"; }
else { dd.style.display = "none"; }
}
//-->
</script>
<script src="http://www.wowhead.com/widgets/power.js"></script>
<script language="javascript" type="text/javascript">
<!-- 
//Browser Support Code
function onEnter( evt ) {
var keyCode = null;
	if( evt.which ) {
		keyCode = evt.which;
	} 
	else if( evt.keyCode ) {
		keyCode = evt.keyCode;
	}
	if( 13 == keyCode ) {
		ajaxFunction();
	  return false;
	}
  return true;
}

function ajaxFunction(sort_index){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById('ajaxDiv');
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
	}
//	var age = document.getElementById('age').value;
//	var wpm = document.getElementById('wpm').value;
//	var sex = document.getElementById('sex').value;
//	var queryString = "?age=" + age + "&wpm=" + wpm + "&sex=" + sex;
	var queryString = "?sort_index=" + sort_index + "&player_filter=" + document.getElementById('player_filter').value + "&months=" + document.getElementById('months').value + "&loots_type=" + document.getElementById('loots_type').checked + "&show_all=" + document.getElementById('show_all').checked;
	ajaxRequest.open("GET", "loot_stats.php" + queryString, true);
	ajaxRequest.send(null); 
}

//-->
</script>
<div id="container">
<div id="top">
<h1><?php echo $SITE_TITLE ?></h1>
</div>
<div id="leftnav">
<?php include "leftnav.php" ?>
</div>
<div id="content">
<p>
Player Filter
<input type="text" id="player_filter" name="player_filter" value="All" onkeypress="return onEnter(event)">
<span onmouseover="ShowText('FilterMessage'); return true;" onmouseout="HideText('FilterMessage'); return true;" href="javascript:ShowText('FilterMessage')"><img src="question_mark.gif"></span>
Months
<input type="text" id="months" name="months" value="2" size="3" onkeypress="return onEnter(event)">
<span onmouseover="ShowText('MonthMessage'); return true;" onmouseout="HideText('MonthMessage'); return true;" href="javascript:ShowText('MonthMessage')"><img src="question_mark.gif"></span>
<input type="checkbox" name="loots_type" id="loots_type" onchange="ajaxFunction()"> Include Rot
<input type="checkbox" name="show_all" id="show_all" onchange="ajaxFunction()"> Show All
</p>
<div id='ajaxDiv'></div>
</div>
<div id="footer">
<?php include "footer.php" ?>
</div>
</div>
<div id="FilterMessage" class="box" style="display: none;">
List of player names seperated by a semi-colon: <br><i>Player1;Player2;Player3</i>
</div> 
<div id="MonthMessage" class="box" style="display: none;">
Past number of months to view the loot from
</div> 
</body>
</html>